package com.sb.money.entities;

// Generated Dec 2, 2012 10:52:01 PM by Hibernate Tools 3.2.2.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name = "category"
        , catalog = "money"
        , uniqueConstraints = @UniqueConstraint(columnNames = "CATEGORY_NAME"))
public class Category implements java.io.Serializable {

    private static final long serialVersionUID = -4549586465593812282L;
    private Long categoryId;
    private String categoryName;
    private Set<Categorization> categorizations = new HashSet<Categorization>(0);

    public Category() {
    }

    public Category(String categoryName) {
        this.categoryName = categoryName;
    }

    public Category(String categoryName, Set<Categorization> categorizations) {
        this.categoryName = categoryName;
        this.categorizations = categorizations;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "CATEGORY_ID", unique = true, nullable = false)
    public Long getCategoryId() {
        return this.categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    @Column(name = "CATEGORY_NAME", unique = true, nullable = false)
    public String getCategoryName() {
        return this.categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
    public Set<Categorization> getCategorizations() {
        return this.categorizations;
    }

    public void setCategorizations(Set<Categorization> categorizations) {
        this.categorizations = categorizations;
    }

}
